import request from '@/utils/request'

// 移动端：按单号查询杂项入库单
export function getMiscRecptByCode(recptCode) {
  return request({
    url: '/mobile/wm/miscrecpt/getByCode',
    method: 'get',
    params: { recptCode: recptCode }
  })
}

// 移动端：根据入库单ID查询入库单及行信息
export function getMiscRecptByRecptId(recptId) {
  return request({
    url: '/mobile/wm/miscrecpt/getByRecptId',
    method: 'get',
    params: { recptId: recptId }
  })
}

// 移动端：根据行ID查询挂牌入库行及已录入明细
export function getMiscRecptDetail(lineId) {
  return request({
    url: '/mobile/wm/miscrecpt/getDetail',
    method: 'get',
    params: { lineId: lineId }
  })
}

// 根据状态查询入库单列表
export function getMiscRecptListByStatus(pageNum, pageSize, status) {
  return request({
    url: '/mobile/wm/miscrecpt/listForStatus',
    method: 'get',
    params: { 
      pageNum: pageNum,
      pageSize: pageSize,
      status: status
    }
  })
}

// 执行入库
export function executeMiscRecpt(recptId) {
  return request({
    url: '/mes/wm/miscrecpt/' + recptId,
    method: 'put'
  })
}

//-------------------明细接口--------------------------
// 新增其他入库单明细
export function addMiscRecptDetail(data) {
  return request({
    url: '/mobile/wm/miscrecpt/detail',
    method: 'post',
    data: data
  })
}

// 修改其他入库单明细
export function updateMiscRecptDetail(data) {
  return request({
    url: '/mobile/wm/miscrecpt/detail',
    method: 'put',
    data: data
  })
}

// 删除其他入库单明细
export function delMiscRecptDetail(detailIds) {
  return request({
    url: '/mobile/wm/miscrecpt/detail/' + detailIds,
    method: 'delete'
  })
}
